local rolely_liechu = fk.CreateSkill {
    name = "rolely_liechu",
}
Fk:loadTranslationTable {
    ["rolely_liechu"] = "烈杵",
    [":rolely_liechu"] = "准备阶段，若你的判定区内有牌，你可以弃置至少一张牌，弃置判定区内等量的牌；你使用【杀】的次数+1，计算与其他角色的距离-1。",

    ["#rolely_liechu-choose"] = "烈杵：你可以弃置至多 %arg 张牌移去判定区等量的牌。",

    ["$rolely_liechu1"] = "愤烈杵凿魂，叫尔等肝肠寸断！",
    ["$rolely_liechu2"] = "断轮回六道，囚神佛，共淹黄泉！",
}

rolely_liechu:addEffect(fk.EventPhaseStart, {
    anim_type = "defensive",
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(rolely_liechu.name) and target == player and player.phase == Player.Start and
            #player:getCardIds("j") > 0 and player:getHandcardNum() > 0
    end,
    on_cost = function(self, event, target, player, data)
        local room = player.room
        local n = #player:getCardIds("j")
        local cards = room:askToDiscard(player, {
            min_num = 1,
            max_num = n,
            include_equip = true,
            skill_name = rolely_liechu.name,
            prompt = "#rolely_liechu-choose:::" .. n,
            cancelable = true,
            skip = true,
        })
        if #cards > 0 then
            event:setCostData(self, { cards = cards })
            return true
        end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local n = #player:getCardIds("j")
        room:throwCard(event:getCostData(self).cards, rolely_liechu.name, player, player)
        if n == #event:getCostData(self).cards then
            player:throwAllCards("j", rolely_liechu.name)
        else
            local cards = room:askToChooseCards(player, {
                min = #event:getCostData(self).cards,
                max = #event:getCostData(self).cards,
                target = player,
                flag = "j",
                skill_name = rolely_liechu.name,
            })
            room:throwCard(cards, rolely_liechu.name, player, player)
        end
    end,
})


rolely_liechu:addEffect("targetmod", {
    residue_func = function(self, player, skill, scope)
        if player:hasSkill(rolely_liechu.name) and skill.trueName == "slash_skill" and scope == Player.HistoryPhase then
            return 1
        end
    end,
})



rolely_liechu:addEffect("distance", {
    correct_func = function(self, from, to)
        if from:hasSkill(rolely_liechu.name) then
            return -1
        end
    end,
})
return rolely_liechu
